package edu.sctu.practice.class02.Wangpeng.Assign03;

/**
 * Created by wp on 2015/11/4.
 */
public class Rectangle extends GeometricObject {
    protected double width;
    protected double height;

    public Rectangle(){
        this(1.0,1.0,"white",1.0);
    }
    public Rectangle(double width,double height){
        this.width=width;
        this.height=height;
    }

    public Rectangle(double width,double height,String color,double weight){
        super(color,weight);
        this.width=width;
        this.height=height;
    }
    public double getWidth(){
        return width;
    }
    public void setWidth(double width){
        this.width=width;
    }
    public double getHeight(){
        return height;
    }
    public void setHeight(double height){
        this.height=height;
    }
    public double findArea(){
        return width*height;
    }
    public double findPerimeter(){
        return 2*(width+height);
    }
    public boolean equals(Rectangle rectangle){
        return (width==rectangle.getWidth())&&(height==rectangle.getHeight());
    }
    public String toString(){
        return "矩形的宽="+width+"矩形的高="+height;
    }
}
